<template>
    <div class="newinfo">
        <h1>{{list.title}}</h1>
        <div class="info">
            <span>发表时间:{{list.add_time|timeF}}</span>
            <span>次数:{{list.click}}</span>
        </div>
        <hr>
        <div class="container" v-html="list.content">
        </div>
         <comm :id='this.id'></comm> 
         <!-- 父子组件传值 -->
    </div>
</template>
<script>
    import {getinfo} from '@/api'
    import {Toast} from 'mint-ui'
    import comment from '@/views/comments/comment'
export default {
    data(){
        return{
           id:this.$route.params.id,
           list:{},
        }
    },
    created(){
        this.info()
    },
    methods:{
        info(){
            getinfo(this.id).then(res=>{
                // console.log(res,1231);
                if(res.status ===0){
                    this.list = res.message[0]
                }else{
                    Toast('获取失败')
                }
                
            })
        }
    },
    components:{
        "comm":comment
    }
}
</script>
<style lang="scss" scoped>
    .newinfo{
        padding: 0 4px;
        h1{
            text-align: center;
            color:red;
            font-size: 16px;
            margin:16px 0;
        }
        .info{
            display: flex;
            justify-content: space-between;
            color:#226aff;
            font-size:13px;
        }
        /deep/img{
            width: 100%;
        }
    }
</style>

